import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/Home.vue";
// 使用插件
Vue.use(VueRouter);

const routes = [
  { path: "*", redirect: "/" },
  {
    path: "/",
    redirect: "/index",
  },
  {
    path: "/",
    name: "Home",
    component: Home,
    children: [
      {
        path: "/index",
        name: "index",
        component: () => import("../views/index/Index.vue"),
        children: [
          {
            path: "/index",
            name: "index",
            component: () => import("../components/index/VideoList.vue"),
          },
        ],
      },
      {
        path: "/friend",
        name: "friend",
        component: () => import("../views/friend/Friend.vue"),
      },
    ],
  },
  {
    path: "/about",
    name: "About",
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/About.vue"),
  },
  {
    path:'/login',
    name:'login',
    component:()=>import('../views/Login.vue')
  },
  {
    path:'/tplogin',
    name:'tplogin',
    component:()=>import('../views/TpLogin.vue')
  },
  
];

const router = new VueRouter({
  // mode: "history", // url不带#
  base: process.env.BASE_URL,
  routes,
});

export default router;
